#pragma once

#include <QHeaderView>

class CheckBoxToHeaderView : public QHeaderView
{
	Q_OBJECT

public:
	CheckBoxToHeaderView(Qt::Orientation orientation, QWidget* parent = 0);
	~CheckBoxToHeaderView();

protected:
    void paintEvent(QPaintEvent* e) override;
    void paintSection(QPainter* painter, const QRect& rect, int logicalIndex) const override;
    void mousePressEvent(QMouseEvent* e) override;

signals:
    void toggled(Qt::CheckState checkState);

public slots:
    void setCheckState(Qt::CheckState checkState);

private:
    bool m_stateChanged;
    Qt::CheckState m_checkState;
    QStyle::State m_state;

};
